 |
|
 |
Subject: Can you control Content-Type for RichText Web Display as HTML? |
 |
 |
 |
Product Area: Domino Designer on Eclipse (DDE) |
 |
Technical Area: Application Development |
 |
Platform: Windows |
 |
Release: 8.5.1 |
 |
Reproducible: Always |
 |
 |
 |
 |
Migrating to R8 we found the "best fit for os" no longer uses Microsoft's EditCtrl ActiveX editor. Now it's Dojo's editor. Some existing/new content cause script errors when Dojo's editor loads rendering it inoperable. PMR was opened with IBM which was escalated to SPR #CJON86S24N. The resolution expectations were disclaimed as follows: "This is a 3rd party product, we can't guarantee a solution"
With that said, I have to have a plan "B" solution. All existing content has been stored as MIME with the Content-Type of "text/html". I've set the RT field to Web Display "HTML" and applied an external JS WYSIWYG editor. When saved, the MIME Content-Type is set to "text/plain". When in edit mode, this is fine. When displaying in read mode, the content is encoded which causes the rendering to display HTML tagging as text.
I tried to create a web query save agent the grabs the RT MIME and tried to set the Content-Type header value to "text/html" but when processed by the server, I still get "text/plain". I then tried capturing the content, removing the item, then re-creating it with the desired header. This (whether coded correctly or not) crashed the server.
Is there any way to retain the RT MIME and store it with a Content-Type of "text/html"?
RichText field
================
Web Access Display: Using HTML
Store content as HTML/MIME: checked
Web Query Save tests
================
Attempt to simply change Content-Type:
=======================================
Dim s As New NotesSession
Dim db As NotesDatabase
Dim theform As NotesForm
Dim view As NotesView
Dim header As NotesMIMEHeader
Dim doccont As NotesDocument
Dim item As Variant
Dim mime As NotesMIMEEntity
Dim flag As Boolean
Set db = s.Currentdatabase
Set doccont = s.Documentcontext
Set theform = db.GetForm(doccont.Form(0))
s.ConvertMime = False
Forall thefield In theform.Fields
Set item = doccont.GetFirstItem(thefield)
If Not item Is Nothing Then
If item.Type = MIME_PART Then
Set mime = item.GetMIMEEntity
Set header = mime.GetNthHeader("Content-Type",1)
Call header.SetHeaderValAndParams("text/html")
End If
End If
End Forall
s.ConvertMime = True
Attempt to remove/re-create MIME (crashes server):
========================================
Dim s As New NotesSession
Dim db As NotesDatabase
Dim theform As NotesForm
Dim view As NotesView
Dim header As NotesMIMEHeader
Dim doccont As NotesDocument
Dim item As Variant
Dim mime As NotesMIMEEntity
Dim stream As NotesStream
Dim tmpString As Variant
Dim flag As Boolean
Set db = s.Currentdatabase
Set doccont = s.Documentcontext
Set theform = db.GetForm(doccont.Form(0))
s.ConvertMime = False
Forall thefield In theform.Fields
Set item = doccont.GetFirstItem(thefield)
If Not item Is Nothing Then
If item.Type = MIME_PART Then
Set mime = item.GetMIMEEntity
Set stream = s.CreateStream
Call mime.GetContentAsText(stream,True)
Call doccont.RemoveItem(thefield)
Call mime.remove()
Set mime = doccont.CreateMIMEEntity(thefield)
Set header = mime.CreateHeader("Content-Transfer-Encoding")
Call header.SetHeaderValAndParams("binary")
Set header = mime.CreateHeader("Content-Type")
Call header.SetHeaderValAndParams("text/html; charset=UTF-8")
Set header = mime.CreateHeader("MIME-Version")
Call header.SetHeaderValAndParams("1.0")
stream.Position = 0
Call mime.SetContentFromText(stream, "text/html;charset=UTF-8", 1730)
Call stream.close()
End If
End If
End Forall
s.ConvertMime = True
 
Feedback number WEBB87AKXD created by ~Patti Opfoolitader on 07/12/2010

Status: Open
Comments:

Can you control Content-Type for Ri... (~Patti Opfoolit... 12.Jul.10)
. . Solution (~Patti Opfoolit... 13.Jul.10) |
|  |
|